package demo.using;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import demo.utils.NewJSON;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : GuoFei
 * @date : 2018/11/9 17:22
 */
public class ParamHelper {

    public static void main(String[] args) {
        List<KeyWord> list = new ArrayList<>();
        list.add(new KeyWord().build("e2","sad",2,3));
        list.add(new KeyWord().build("e1","sdsdfad",2,3));
        list.add(new KeyWord().build("efsd2","safsd",4,5));
        System.out.println(JSON.toJSONString(list));
    }
/*
 {"intoPlanImg":{"messageType":2,"pushType":3,"desc":"进入计划图片(img)"},
 "userName":{"messageType":1,"pushType":1,"desc":"用户姓名(text)"}}
  */
static class KeyWord extends JSONObject{

    public KeyWord (){
    }
    public KeyWord put(String k, Object v){
        super.put(k, v);
        return this;
    }
    public KeyWord build(String name,String desc,int messageType,int pushType ){
        this.put(name, new KeyWord().put("desc", desc).put("messageType",messageType).put("pushType",pushType));
        return this;
    }

}

}
